<?php

/**
 * TbsClientePlan filter form base class.
 *
 * @package    AltargetEcommerce
 * @subpackage filter
 * @author     Carlo Lopez
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTbsClientePlanFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'clpl_fechasusc'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'clpl_periodicidad' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'clpl_cupo'         => new sfWidgetFormFilterInput(),
      'clpl_status'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'clpl_codcli'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codcli'), 'add_empty' => true)),
      'clpl_codplan'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fk_clpl_codplan'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'clpl_fechasusc'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'clpl_periodicidad' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'clpl_cupo'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'clpl_status'       => new sfValidatorPass(array('required' => false)),
      'clpl_codcli'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_clpl_codcli'), 'column' => 'cli_codigo')),
      'clpl_codplan'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fk_clpl_codplan'), 'column' => 'plan_codigo')),
    ));

    $this->widgetSchema->setNameFormat('tbs_cliente_plan_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TbsClientePlan';
  }

  public function getFields()
  {
    return array(
      'clpl_codigo'       => 'Number',
      'clpl_fechasusc'    => 'Date',
      'clpl_periodicidad' => 'Number',
      'clpl_cupo'         => 'Number',
      'clpl_status'       => 'Text',
      'clpl_codcli'       => 'ForeignKey',
      'clpl_codplan'      => 'ForeignKey',
    );
  }
}
